<?php
//通过PDO连接MYSQL
$db = new PDO("mysql:host=127.0.0.1;dbname=scholl;charset=utf8","root","123456");
//查询stu内的数据
$sql="select * from stu";
$result=$db->query($sql);
$arr=$result->fetchAll(PDO::FETCH_OBJ);
foreach($arr as $obj){
	echo $obj->id,"---",$obj->name,"---",$obj->age,"---",$obj->sex,"<br/>";
}
//var_dump($result);
?>